@echo off
cls
echo =====================================
echo   MyWallet - Run App
echo =====================================
echo.
echo This will:
echo   1. Get dependencies
echo   2. Generate code
echo   3. Start app in Chrome
echo.
echo Port: 3000
echo URL: http://localhost:3000
echo.
echo Press any key to start...
pause >nul

cls
echo.
echo Starting MyWallet...
echo.

echo [Step 1/3] Getting dependencies...
call flutter pub get
if errorlevel 1 (
    echo.
    echo ERROR: Failed to get dependencies!
    echo.
    echo Please check:
    echo   1. Internet connection
    echo   2. Flutter is installed
    echo   3. Run: flutter doctor
    echo.
    goto :error
)
echo OK
echo.

echo [Step 2/3] Generating code...
call flutter packages pub run build_runner build --delete-conflicting-outputs
if errorlevel 1 (
    echo WARNING: Code generation failed
    echo The app may still work
)
echo OK
echo.

echo [Step 3/3] Starting app...
echo.
echo The app will open in Chrome browser
echo URL: http://localhost:3000
echo.
echo Commands:
echo   Press 'r' - Hot reload
echo   Press 'R' - Hot restart  
echo   Press 'q' - Quit app
echo.
echo Starting...
echo.

call flutter run -d chrome --web-port 3000

:end
echo.
echo =====================================
echo App Stopped
echo =====================================
echo.
echo Press any key to close...
pause >nul
exit /b 0

:error
echo.
echo =====================================
echo Error Occurred
echo =====================================
echo.
pause >nul
exit /b 1
